simplify replaceFile using relatedTemplate
authorJoey Hess <joeyh@joeyh.name>
Wed, 22 Jan 2025 17:22:51 +0000 (13:22 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 22 Jan 2025 17:25:06 +0000 (13:25 -0400)
commitaf3b9cbd3647ecfb3f3f6c4008dc9e64f7d42591
tree5d1bcbd3e7052f8ba956dc2c3cc0227a75266fd9
parentf17ec601c4d138a45bb01ac8614f7df0f821f0d3
simplify replaceFile using relatedTemplate

Now that truncateFilePath and relatedTemplate have both been optimised,
may as well use them in replaceFile, rather than the custom hack it
used.

Removed the windows-specific ifdef as well, because on Windows long
filepaths no longer really a problem, since ghc and git-annex use UNC
converted paths.

replaceFile no longer checks fileNameLengthLimit. That took a syscall,
and since we have an existing file, we know filenames of its length are
supported by the filesystem. Assuming that the withOtherTmp directory is
on the same filesystem as the file replaceFile is being called on, which
I believe it is.

Sponsored-by: Leon Schuermann
Annex/ReplaceFile.hs
Utility/Tmp.hs